package com.zyh.work3

class Worker(var name:String,var age:Int,var salary:Double) {
  def this() = this(null,0,0.0)

  override def toString: String = s"$name,$age,$salary"
}
object Worker{
  def main(args: Array[String]): Unit = {
    val worker = new Worker("zhao6",24,3300)
    var list: List[Worker] = List()
    list = list:+new Worker("zhang3",18,3000)
    list = list:+new Worker("li4",25,3500)
    list = list:+new Worker("wang5",22,3200)

    for(item <- list if item.age > 20) println(item)
  }
}
